package com.News.impl;

import java.util.List;

import com.News.NewsService;
import com.dao.NewsDao;
import com.entity.News;
import com.utils.MybatisUtil;
import com.utils.Pager;

/**
 * 新闻咨询接口实现类service层
 * @author 
 *
 */
public class NewsServiceImpl implements NewsService{
	
	
	@Override
	/**
	 * 查询所有的新闻资讯信息
	 */
	public List<News> finSelectNews(Pager pager) {
		NewsDao news = MybatisUtil.getMapper(NewsDao.class);
		List<News> newsList = news.selectNews(pager);
		MybatisUtil.closeCommit();
		return newsList;
	}

	@Override
	public int getTotalCount() {
		NewsDao news = MybatisUtil.getMapper(NewsDao.class);
		int totalCount = news.totalCount();
		MybatisUtil.closeCommit();
		return totalCount;
	}

	@Override
	public News findNewsById(int id) {
		NewsDao news = MybatisUtil.getMapper(NewsDao.class);
		News newsById = news.newsById(id);
		MybatisUtil.closeCommit();
		return newsById;
	}

}
